package com.lcxw.hxzbapi.scheduleTask;

import com.lcxw.hxzbapi.entity.pojo.Paging;
import com.lcxw.hxzbapi.service.PagingService;
import java.util.List;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class PagingClear {

    @Resource
    PagingService pagingService;

    @Scheduled(cron = "0/30 * * * * ?")
    void clearPaging() {

        List<Paging> expire = pagingService.getExpire();
        for (Paging paging : expire) {
            pagingService.deleteById(paging.getId());
        }
    }
}
